package com.itheima02;

import java.util.Random;
import java.util.Scanner;

public class 猜数字 {
    public static void main(String[] args) {
        Random r = new Random();
        int guess = r.nextInt(100) + 1;
        Scanner sc = new Scanner(System.in);
        System.out.println(r);

        while (true) {
            System.out.println("请输入一个1-100之间的整数");
            int num = sc.nextInt();

            if (guess == num) {
                System.out.println("恭喜你，猜对了");
                break;
            } else if (num > guess) {
                System.out.println("您猜想的数字大了哦");
            } else {
                System.out.println("您猜想的数字小了哦");
            }
        }

    }
}
